package trading_strategy.events;

import java.util.Date;

/**
 * Created by IntelliJ IDEA.
 * User: gderoujoux
 * Date: 6 mai 2010
 * Time: 10:23:43
 * To change this template use File | Settings | File Templates.
 */
public abstract class AbstractMarketEvent {
    /**
     * Timestamp of the event in us since epoch
     */
    long ts;
    Date date = null;

    public AbstractMarketEvent(long ts) {
        this.ts = ts;
    }

    public AbstractMarketEvent() {
        this.ts = System.nanoTime();
    }

    /**
     * Gets the date representing this event's date in the current TimeZone
     */
    public Date getDate() {
        if (date == null) {
            date = new Date(ts / 1000l);
        }
        return date;
    }

    public long getTs() {
        return ts;
    }
}
